from sqlalchemy import Column, String, INTEGER, DateTime

from sqlConfig import Base


class Chat(Base):
    __tablename__ = 'chats'

    chatID = Column(INTEGER(), primary_key=True, autoincrement=True)

    dormitoryID = Column(String(12), primary_key=False)

    speaker = Column(String(12), nullable=False)

    datetime = Column(DateTime(), nullable=False)

    content = Column(String(1024), nullable=False)

    def __init__(self, dormitoryID, speaker, datetime, content):
        self.dormitoryID = dormitoryID
        self.speaker = speaker
        self.datetime = datetime
        self.content = content


